﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using WeBlog.Interfaces;

namespace WeBlog.Models
{
    public class Category : IModel
    {
        [Key]
        public int CategoryId { get; set; }

        public int? ParentId { get; set; }

        [Required]
        [StringLength(50)]
        public string Name { get; set; }

        [StringLength(255)]
        public string Description { get; set; }

        [Required]
        public DateTime DateCreated { get; set; }
        public DateTime DateModified { get; set; }
        
        public virtual ICollection<Post> Posts { get; set; }        

        public Category()
        {
            DateCreated = DateTime.Now;
            DateModified = DateCreated;
        }
    }
}
